package com.example.farmer.Entity;

public class CirclePost {
    private int id; // 唯一标识符
    private String content; // 帖子内容
    private String imageUrl; // 帖子图片的路径或URL
    private String userNumber;
    private boolean hasImage; // 指示是否有关联的图片
    private boolean liked;


    // 构造函数
    public CirclePost(int id, String content, String imageUrl) {
        this.id = id;
        this.content = content;
        this.imageUrl = imageUrl;
    }
    public boolean isLiked() {
        return liked;
    }
    public void setLiked(boolean liked) {
        this.liked = liked;
    }

    public CirclePost(String content, String imageUrl) {
        this.content = content;
        this.imageUrl = imageUrl;
    }


    public CirclePost() {

    }

    public CirclePost(int id,String content, String imageUrl,String userNumber) {
        this.id = id;
        this.content = content;
        this.imageUrl = imageUrl;
        this.userNumber = userNumber;
    }
    public CirclePost(String content, String imageUrl,String userNumber) {
        this.content = content;
        this.imageUrl = imageUrl;
        this.userNumber = userNumber;
    }

    // 获取帖子内容
    public String getContent() {
        return content;
    }

    // 设置帖子内容
    public void setContent(String content) {
        this.content = content;
    }

    // 获取图片路径
    public String getImageUrl() {
        return imageUrl;
    }

    // 设置图片路径
    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
        this.hasImage = (imageUrl != null && !imageUrl.isEmpty());
    }

    // 检查帖子是否有图片
    public boolean hasImage() {
        return this.hasImage = (imageUrl != null && !imageUrl.isEmpty());
    }

    // 获取帖子ID
    public long getId() {
        return id;
    }

    // 设置帖子ID
    public void setId(int id) {
        this.id = id;
    }

    public String getUserNumber() {
        return userNumber;
    }

    public void setUserNumber(String userNumber) {
        this.userNumber = userNumber;
    }


    @Override
    public String toString() {
        return "CirclePost{" +
                "userNumber='" + userNumber + '\'' +
                ", id=" + id +
                ", content='" + content + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", hasImage=" + hasImage +
                ", liked=" + liked +
                '}';
    }
}
